<?php
namespace app\admin\validate;

use think\Validate;

class GoodsValidate extends Validate
{
    protected $rule =   [
        'id '                   => 'require|number',
        'admin_id|店铺'         => 'require|number',
        'cate_id|分类'          => 'require|number',
        'title|名称'            => 'require|length:1,100',
        'subtitile|简介'        => 'require|length:1,100',
        'price|价格'            => 'require|gt:0',
        'price_original|划线价' => 'require|gt:0',
        'small_img|缩略图'      => 'require|image',
        'banner_img|轮播图'     => 'require',
        'status|状态'           => 'require|number',
        'page|页数'             => 'require|number',
        'limit|条数'            => 'require|number',
        'number|使用次数'        => 'require',
        'use_days|使用期限'      => 'require',
        'fst_rate|一级分销'      => 'require',
        'sec_rate|二级分销'      => 'require',
    ];
    
    protected $scene = [
        'show'          => ['id'],
        'list'          => ['page', 'limit'],
        'goods_list'    => ['admin_id'],
        'add'           => ['admin_id', 'title', 'subtitile', 'price', 'price_original', 'small_img', 'banner_img', 'is_discount'],
        'edit'          => ['id', 'admin_id', 'title', 'subtitile', 'price', 'price_original', 'banner_img', 'is_discount'],
        'edit_img'      => ['id', 'admin_id', 'title', 'subtitile', 'price', 'price_original', 'small_img', 'banner_img', 'is_discount'],
        'card_add'      => ['admin_id', 'cate_id', 'title', 'subtitile', 'price', 'price_original', 'number', 'use_days', 'fst_rate', 'sec_rate', 'small_img', 'banner_img', 'is_discount'],
        'card_edit_img' => ['id', 'admin_id', 'cate_id', 'title', 'subtitile', 'price', 'price_original', 'number', 'use_days', 'fst_rate', 'sec_rate', 'small_img', 'banner_img', 'is_discount'],
        'card_edit'     => ['id', 'admin_id', 'cate_id', 'title', 'subtitile', 'price', 'price_original', 'number', 'use_days', 'fst_rate', 'sec_rate', 'banner_img', 'is_discount'],
    ];
}